package frsf.cidisi.exercise.arq.search;

import java.util.HashMap;
import java.util.Set;

import Entidades.Tesoro;
import frsf.cidisi.faia.agent.Agent;
import frsf.cidisi.faia.agent.Perception;
import frsf.cidisi.faia.environment.Environment;

public class AgenteArqueologoPerception extends Perception {

	
	private boolean sensorpirata;
	private Tesoro camara;
	private String gps; /*indica la posicion actual del arqueologo*/
	private HashMap<String,Tesoro> satelite;
	
    public  AgenteArqueologoPerception() {
   	
    }

    public AgenteArqueologoPerception(Agent agent, Environment environment) {
        super(agent, environment);
    }

    /**
     * This method is used to setup the perception.
     */
    public void initPerception(Agent agentIn, Environment environmentIn) {
    	
    	IslaEmiroce is=(IslaEmiroce) environmentIn;
    	EstadoIsla estadoIsla=is.getEnvironmentState();
    	this.gps=estadoIsla.getposicionArqueologo();
    	
    	if(estadoIsla.getTesoro(gps)!=null)
    		this.camara=estadoIsla.getTesoro(gps).clone();
    	else
    		this.camara=null;
    	
    	this.satelite=estadoIsla.getMapaTesoros();
    	this.sensorpirata=gps.equals(estadoIsla.getposicionPirata());
     
    }
    
    public String toString() {
        String str ="";
        String str1="";
          	
        str="\nGPS(ciudad actual): "+ gps+" ";
        
        if(camara!=null)
        {
         str+="\nCamara(tesoro ciudad actual): "+ camara.toString()+"\n";	
        }
        else
        	str+="\nCamara(tesoro ciudad actual):---\n";
        
        Set<String> ciudadesConTesoro=this.satelite.keySet();
        str1=ciudadesConTesoro.toString();
        
        str+="Satelite: "+str1+"\n";

        return str;
    }

    // The following methods are agent-specific:
    //TODO: Complete this section with the agent-specific methods
	
     public boolean getsensorpirata(){
        return sensorpirata;
     }
     public void setsensorpirata(boolean arg){
        this.sensorpirata = arg;
     }
     public Tesoro getcamara(){
        return camara;
     }
     public void setcamara(Tesoro arg){
    	this.camara = arg;	 
        
     }
     public String getgps(){
        return gps;
     }
     public void setgps(String arg){
        this.gps = arg;
     }

	public HashMap<String, Tesoro> getSatelite() {
		return satelite;
	}

	public void setsatelite(HashMap<String, Tesoro> mapaTesoros) {
		this.satelite=mapaTesoros;
		
	}
     
	
   
}
